package com.hunter.jerrymouse.request;

import com.hunter.jerrymouse.annotation.request.RequestRouter;
import com.hunter.jerrymouse.annotation.response.ResponseData;

import java.lang.reflect.Method;
import java.util.Arrays;

/**
 * Created by hunter
 * <p>
 * 请求的处理者封装类
 */
public class RequestHandle {

    /**
     * 请求的类
     */
    private Class<?> clazz;

    /**
     * 请求的类方法
     */
    private Method method;

    /**
     * 请求的类方法的参数信息, 这里用的是自己的封装类
     */
    private RequestParameter[] requestParameters;

    /**
     * 支持的http请求方法
     */
    private RequestRouter.Method[] supportHttpMethod;

    /**
     * 响应体格式
     */
    private ResponseData.ContentType responseContentType;

    public Class<?> getClazz() {
        return clazz;
    }

    public void setClazz(Class<?> clazz) {
        this.clazz = clazz;
    }

    public Method getMethod() {
        return method;
    }

    public void setMethod(Method method) {
        this.method = method;
    }

    public RequestRouter.Method[] getSupportHttpMethod() {
        return supportHttpMethod;
    }

    public void setSupportHttpMethod(RequestRouter.Method[] supportHttpMethod) {
        this.supportHttpMethod = supportHttpMethod;
    }

    public RequestParameter[] getRequestParameters() {
        return requestParameters;
    }

    public void setRequestParameters(RequestParameter[] requestParameters) {
        this.requestParameters = requestParameters;
    }

    public ResponseData.ContentType getResponseContentType() {
        return responseContentType;
    }

    public void setResponseContentType(ResponseData.ContentType responseContentType) {
        this.responseContentType = responseContentType;
    }

    @Override
    public String toString() {
        return "RequestHandle{" +
                "clazz=" + clazz +
                ", method=" + method +
                ", supportHttpMethod=" + Arrays.toString(supportHttpMethod) +
                ", responseContentType=" + responseContentType +
                '}';
    }
}
